package com.fyzk.activity.prize.detail;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.fyzk.bean.AwardDetail;
import com.tyjc.lottery.R;

import java.util.ArrayList;

public class AwardInfoAdapter extends BaseAdapter {
	ArrayList<AwardDetail.LevelsBean> list;
	Context mContext;

	public AwardInfoAdapter(Context mContext, ArrayList<AwardDetail.LevelsBean> levelList) {
		this.mContext = mContext;
		this.list = levelList;
	}

	public int getCount() {
		return this.list.size();
	}

	public Object getItem(int paramInt) {
		return this.list.get(paramInt);
	}

	public long getItemId(int paramInt) {
		return paramInt;
	}

	public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
		ViewHolder localViewHolder = null;
		if (paramView == null) {
			paramView = LayoutInflater.from(this.mContext).inflate(
					R.layout.zy_layout_prizedetail_level_item, null);
			localViewHolder = new ViewHolder();
			localViewHolder.layout_award_awardName = ((TextView) paramView
					.findViewById(R.id.zy_layout_prizedetail_awardName));
			localViewHolder.layout_award_awardNum = ((TextView) paramView
					.findViewById(R.id.zy_layout_prizedetail_awardBet));
			localViewHolder.layout_award_singleBonus = ((TextView) paramView
					.findViewById(R.id.zy_layout_prizedetail_singleBonus));
			paramView.setTag(localViewHolder);
		} else {
			localViewHolder = (ViewHolder) paramView.getTag();
		}

		AwardDetail.LevelsBean bean = this.list.get(paramInt);

		localViewHolder.layout_award_awardName.setText(bean.getLevel());
		if(bean.getCount() == null || bean.getCount().equals("")){
			localViewHolder.layout_award_awardNum.setVisibility(View.GONE);
		}else{
			localViewHolder.layout_award_awardNum.setText(bean.getCount());
		}
		localViewHolder.layout_award_singleBonus.setText(bean.getAmount());
		return paramView;
	}

	class ViewHolder {
		TextView layout_award_awardName;
		TextView layout_award_awardNum;
		TextView layout_award_singleBonus;

	}
}